package jsyf.oa.web.report.newAppReport;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.newAppReport.NewAppReportForBRMFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "全新的APP报表FOR大区经理", description = "全新的APP报表FOR大区经理")
@Controller
@RequestMapping("/newAppReportForBRM")
public class NewAppReportForBRMController {

    @Resource
    private NewAppReportForBRMFacade newAppReportForBRMFacade;

    @ResponseBody
    @RequestMapping(value = "/getIntentCustomerListForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取个人意向客户",
            notes = "获取个人意向客户",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getIntentCustomerListForBRM(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getIntentCustomerListForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getCostByUserIdAndDateTimeForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理今日费用",
            notes = "大区经理今日费用",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getCostByUserIdAndDateTimeForBRM(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getCostByUserIdAndDateTimeForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodaySignForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理考勤签到",
            notes = "大区经理考勤签到",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodaySignForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getTodaySignForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getCustomerNumByUserIdAndDateTimeForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理客户管理",
            notes = "大区经理客户管理",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getCustomerNumByUserIdAndDateTimeForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getCustomerNumByUserIdAndDateTimeForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getVisitByUserIdAndDateTimeForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理面电访",
            notes = "大区经理面电访",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面,status//0-AM/1-PM}", dataType = "String", paramType = "body")
    })
    public void getVisitByUserIdAndDateTimeForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getVisitByUserIdAndDateTimeForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getTodayPlanByUserIdAndDateTimeForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理今日计划",
            notes = "大区经理今日计划 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "\"{'userId':'','dateTime':'yyyy-MM-dd'}\"", dataType = "String", paramType = "body")
    public void getTodayPlanByUserIdAndDateTimeForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getTodayPlanByUserIdAndDateTimeForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodayFirstVisitAndSignForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理首次面访",
            notes = "大区经理首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayFirstVisitAndSignForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getTodayFirstVisitAndSignForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getVisitCustomerByUserIdAndDateTimeForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理报表拜访",
            notes = "大区经理报表拜访 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "\"{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面}\"", dataType = "String", paramType = "body")
    public void getVisitCustomerByUserIdAndDateTimeForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getVisitCustomerByUserIdAndDateTimeForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getWechatShareListForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理微信转发",
            notes = "大区经理微信转发",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'20171216210041E5A8F7995E68215C12',dateTime:'2018-05-11'}", dataType = "String", paramType = "body")
    public void getWechatShareListForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getWechatShareListForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSaleForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理销售目标",
            notes = "大区经理销售目标",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getSaleForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getSaleForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTeamBuildingForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理团队建设报表",
            notes = "大区经理团队建设报表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getTeamBuildingForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getTeamBuildingForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }


    @RequestMapping(value = "/getVisitPeopleByUserIdAndDateTime.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理拜访客户",
            notes = "大区经理拜访客户",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getVisitPeopleByUserIdAndDateTime(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getVisitPeopleByUserIdAndDateTime(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getFinishByUserIdAndDateTime.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售报表完成",
            notes = "销售报表完成",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getFinishByUserIdAndDateTime(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getFinishByUserIdAndDateTime(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getForPersonalByUserIdAndDateTime.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "点击微信转发",
            notes = "点击微信转发",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getForPersonalByUserIdAndDateTime(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getForPersonalByUserIdAndDateTime(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));

    }


    @RequestMapping(value = "/getAllCustomerForRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理所有的客户",
            notes = "大区经理所有的客户",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getAllCustomerForRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getAllCustomerForRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getNewCustomerForRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理新的客户",
            notes = "大区经理新的客户",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getNewCustomerForRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getNewCustomerForRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getIntentCustomerForMonth.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "意向客户点击",
            notes = "意向客户点击",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getIntentCustomerForMonth(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getIntentCustomerForMonth(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "工作报告",
            notes = "工作报告",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getEmailByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getEmailByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSalesAwardAmount.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售奖惩金额",
            notes = "销售奖惩金额",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getSalesAwardAmount(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getSalesAwardAmount(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodayPlanRemind.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日计划",
            notes = "今日计划",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getTodayPlanRemind(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        Boolean result = newAppReportForBRMFacade.getTodayPlanRemind();
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("result",result);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(jsonObject));
    }

    @RequestMapping(value = "/firstVisitRemind.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "首次面访",
            notes = "首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void firstVisitRemind(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        Boolean result = newAppReportForBRMFacade.firstVisitRemind();
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("result",result);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(jsonObject));
    }

    @RequestMapping(value = "/amVisitRemind.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "上午面访",
            notes = "上午面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void amVisitRemind(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        Boolean result = newAppReportForBRMFacade.amVisitRemind();
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("result",result);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(jsonObject));
    }

    @RequestMapping(value = "/regionAndCompanyByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域",
            notes = "区域",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void regionAndCompanyByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.regionAndCompanyByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/daQuVisit.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区陪跑报表",
            notes = "大区陪跑报表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void daQuVisit(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.daQuVisit(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/daQuVisitByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区陪跑点击",
            notes = "大区陪跑点击",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void daQuVisitByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.daQuVisitByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getCostListByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区费用报表",
            notes = "大区费用报表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getCostListByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForBRMFacade.getCostListByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
}

